<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>当前时分秒</title>

    <script>
        var time=new Date();

        function getTime(){
            var h=time.getHours();
            h=h<10?'0'+h:h;
            var m=time.getMinutes();
            m=m<10?'0'+m:m;
            var s=time.getSeconds();
            s=s<10?'0'+s:s;
            return h+':'+m+':'+s;
        }

        console.log(getTime());



    </script>



</head>
<body>
    
</body>
</html>